Skip to content

Hit with no skill on a pet's basic attack - #3633

Merged
erwan-joly merged 1 commit into
masterfrom
fix/pet-basic-attack
Nov 20, 2026
Merged

erwan-joly merged 1 commit into
masterfrom
fix/pet-basic-attack

Conversation

@erwan-joly

@erwan-joly erwan-joly commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What

A pet's basic attack asked the skill resolver for cast 0. Cast 0 matches any skill the pet knows, so a pet with skills of its own swung with the first one, using that skill's reach, cooldown, animation and cards. Sending a NosMate or an escort at a monster with suctl read the packet's first field as a cast id the same way: it cast whichever skill matched it, and a pet with no skills at all could not attack.

In the packet traces every hit that a pet, partner or time-space escort lands after being sent at a monster is skill 0 with animation 11, the creature's own basic cooldown and its EFF value as the hit effect. That is the same shape as a monster's basic hit. A level 71 pet whose monster data lists a skill (vnum 709, skill 790) hits with su 2 <pet> 3 <monster> 0 14 11 0 ...: its ZSKILL cooldown is 14 and its EFF is 0. A starter pet (vnum 9) reads 0 12 11 200, and an escort NPC (vnum 320) reads 0 12 11 200 too. suctl's first field follows the c_map the client is on, so it never names a skill.

What changes:

  • MateAttackService.BasicAttackAsync takes any NPC-like creature and hits with HitArguments { BasicAttack = true }, so SkillResolver.ResolveBasic handles it: no skill, no cards, animation 11, the EFF value as the effect, and reach and cooldown from the creature's data.
  • MateControlService.AttackAsync (suctl) uses that same basic attack for a team NosMate and for an escort led by the player, and ignores the first field.
  • A NosMate's skills are cast only from its skill bar (u_pet with a skill, u_ps), and those paths are unchanged.

Fixes #3632

Tests

  • MateBasicAttackTests (new, GameObject) uses the real battle service and resolver on a pet that knows a skill with cards. The hit is skill 0 with no cards, and the su is compared as a typed SuPacket with PacketAssert: skill 0, the pet's cooldown, animation 11 and the pet's effect. Both tests fail on master.
  • SkillResolverTests.APetsBasicAttackIsItsOwnHitNotTheSkillItKnows (new) runs ResolveBasic on a spawned pet. It passes on master too, because the bug was at the call site, not in the resolver.
  • SuCtlPacketHandlerTests is rewritten for the basic attack: an own pet and an escort hit with BasicAttack, a first field that matches a skill's cast id picks no skill, a pet without skills still attacks, basic range and basic cooldown are enforced, and other players' mates, players and unknown targets are refused. 5 of these fail on master.
  • UpetPacketHandlerTests.APetsBasicAttackIsNoneOfItsSkills (new) fails on master.
  • E2E PetTests.APetSentAtAMonsterHitsItWithItsBasicAttackNotItsSkill (new) sends suctl and expects the pet's su to be skill 0 with cooldown 20, animation 11 and effect 0. On master the pet casts skill 220.
  • Full NosCore.GameObject.Tests (2816) and NosCore.PacketHandlers.Tests (1002) pass. E2E PetTests + PartnerTests pass (9).

In the client

Not checked yet. The "Ordering NosMates" section of documentation/manual-test-plan.md now has these steps:

  • With the pet beside a monster, attack the monster. The pet joins in, the damage shows on both screens and the bar drops. A Chicken (333) does the same.
  • The pet's su lines read skill 0, animation 11, its own basic cooldown and hit effect (14/0 for vnum 709, 12/200 for vnum 9).
  • An Otter (683) left to fight never plays its skills, keeps its MP, and none of its bar's slots grey out.
  • The pet hits no faster than its basic cooldown. It does not hit a monster across the map, a player or an NPC.
  • A time-space escort sent at a monster hits with skill 0 and animation 11.

Still open

  • In the traces, some su cooldowns are shorter than the data: a starter pet's first hit on a target reads 12 and later ones mostly 5, and a partner (vnum 319, ZSKILL 12) reads 6. This PR sends the ZSKILL value.
  • In the traces, the field after the hit mode is 0 on every basic hit. Here it is AttackClass - 1.
  • The su x/y of a basic hit is 0 0 in the traces. Here it is the attacker's position.
  • SuCtlPacket.CastId is really the client's map id, and suctl can name several mates (suctl <map> 2 <mate> 3 <target> <mate> 3 <target>). Both belong in NosCore.Packets.

Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Pets and eligible time-space escorts now use basic attacks when ordered to attack nearby monsters, including pets without skills.
    • Pet attacks use basic-attack cooldowns and animations.
  • Bug Fixes
    • Pets no longer autonomously use their learned skills when carrying out attack orders.
    • Attack orders are limited by target eligibility, map, range, and cooldown checks.

A pet's basic attack resolved cast 0, which matches any skill the pet
knows, so a pet with skills of its own swung with the first of them: its
reach, cooldown, animation and cards. Sending a NosMate or an escort at a
monster with suctl did the same with the packet's first field, and refused
to attack at all for a creature with no skills.

In the packet traces every hit a pet, partner or escort lands when sent at
a monster is skill 0 with animation 11, the creature's own basic cooldown
and its EFF value as the effect, whatever suctl's first field holds. Both
orders now go through one basic attack: no skill, no cards, reach and
cooldown from the creature's data. Its skills are cast only from its skill
bar.

Fixes #3632

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CUfJ46iekh4rbiCyoTamtn
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Pet and escort attack orders now trigger basic attacks instead of selecting pet skills. Basic attack resolution checks the attacker’s map, cooldown, and range, then submits a hit marked as a basic attack. Tests and the manual test plan cover attack data, order handling, and related combat behavior.

Changes

Pet and escort basic attacks

Layer / File(s) Summary
Basic attack resolution
src/NosCore.GameObject/Services/MateService/IMateAttackService.cs, src/NosCore.GameObject/Services/MateService/MateAttackService.cs, test/NosCore.GameObject.Tests/Services/BattleService/*, test/NosCore.EndToEnd.Tests/Infrastructure/WorldData.cs, test/NosCore.EndToEnd.Tests/Scenarios/PetTests.cs
The attack service accepts a non-playable attacker and checks its map, cooldown, and range before submitting a basic hit. Unit and end-to-end tests check hit data and configured basic attack properties.
Attack order routing
src/NosCore.GameObject/Services/MateService/IMateControlService.cs, src/NosCore.GameObject/Services/MateService/MateControlService.cs, src/NosCore.PacketHandlers/Mates/SuCtlPacketHandler.cs, test/NosCore.PacketHandlers.Tests/Mates/*, documentation/manual-test-plan.md
Mate attack orders no longer pass a cast ID or select pet skills. The control service delegates eligible pet and escort attacks to basic attack resolution. Packet handler tests and the manual plan cover the updated behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant SuCtlPacketHandler
  participant MateControlService
  participant MateAttackService
  participant BattleService
  SuCtlPacketHandler->>MateControlService: AttackAsync(owner, mateTransportId, target)
  MateControlService->>MateAttackService: BasicAttackAsync(attacker, target)
  MateAttackService->>BattleService: Hit with BasicAttack=true
  BattleService-->>MateAttackService: Hit result
  MateAttackService-->>MateControlService: Attack result
Loading

Possibly related PRs

  • NosCoreIO/NosCore#2647: Introduced the suctl mate attack path that this change updates.
  • NosCoreIO/NosCore#2652: Changes basic attack range and cooldown handling for NosMates, which is related to the basic attack behavior covered here.

Suggested reviewers: claude

Merge Risk: Minimal · up to b6e16

Pet and escort attack orders now use the creature's own basic attack instead of accidentally casting a skill the pet knows. No concrete defect was found, and the earlier concern about overlapping attack orders was ruled out by per-session packet serialization. The remaining gap is that client behavior has not been manually verified, which is already tracked in the manual test plan.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Hit with no skill on a pet's basic attack" matches the main change. The PR makes pet basic attacks (and suctl attacks by mates and escorts) use HitArguments with BasicAttack = true, so the …
Linked Issues check Passed Issue #3632 requires that a pet's basic attack use skill 0 with the pet's own basic cooldown, range and hit effect, and that skills cast only when used. At the reviewed head, MateAttackService.BasicAt…
Out of Scope Changes check Passed Changes map to the basic-attack fix for #3632. MateAttackService and MateControlService change the call path to BasicAttack hits. MateControlService drops its skill, cooldown and catalog dependencies …
Full details: Title check

Explanation

The title "Hit with no skill on a pet's basic attack" matches the main change. The PR makes pet basic attacks (and suctl attacks by mates and escorts) use HitArguments with BasicAttack = true, so the hit reports no skill. The changes to MateAttackService, MateControlService, and the related tests all support this. The title is specific and short, and it describes the primary behavior change.

Full details: Linked Issues check

Explanation

Issue #3632 requires that a pet's basic attack use skill 0 with the pet's own basic cooldown, range and hit effect, and that skills cast only when used. At the reviewed head, MateAttackService.BasicAttackAsync (diff against merge base) calls battleService.Hit with HitArguments { BasicAttack = true } instead of SkillId = 0. The cooldown and range come from the attacker's NpcMonster data. MateControlService.AttackAsync (head file) no longer accepts a cast id and delegates to BasicAttackAsync for an owned team NosMate or a player-led escort. The first field of suctl is removed, so it cannot select a skill. Skill casts remain on the skill-bar path (u_pet with a skill, u_ps), which the PR states is unchanged. The new tests (MateBasicAttackTests, SkillResolverTests, SuCtlPacketHandlerTests, UpetPacketHandlerTests, E2E PetTests) target this behavior. I did not run the tests. The result relies on the code diff and the PR's reported test results. The open items in the PR description (cooldown values in traces, field after hit mode, coordinates, SuCtlPacket.CastId naming) are not part of issue #3632 and are disclosed as not addressed.

Full details: Out of Scope Changes check

Explanation

Changes map to the basic-attack fix for #3632. MateAttackService and MateControlService change the call path to BasicAttack hits. MateControlService drops its skill, cooldown and catalog dependencies and gains IMateAttackService. SuCtlPacketHandler stops passing CastId. The escort branch of AttackAsync reuses the same basic-attack path. This extends the fix to time-space escorts, which the issue does not name. It is the same call site and is part of the same defect, so it is not an unrelated change. Test changes (renamed packet test, rewritten SuCtlPacketHandlerTests, new E2E test, WorldData.PetBasicCooldown constant) support the fix. The manual-test-plan.md edit is documentation of the same behavior. No unrelated functional change was found in the reviewed diffs. The MateControlService diff could not be read as a diff, but its head file content was read and matches the summary.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7401d34 and b6e168f.

Files selected for processing: 13

  • documentation/manual-test-plan.md
  • src/NosCore.GameObject/Services/MateService/IMateAttackService.cs
  • src/NosCore.GameObject/Services/MateService/IMateControlService.cs
  • src/NosCore.GameObject/Services/MateService/MateAttackService.cs
  • src/NosCore.GameObject/Services/MateService/MateControlService.cs
  • src/NosCore.PacketHandlers/Mates/SuCtlPacketHandler.cs
  • test/NosCore.EndToEnd.Tests/Infrastructure/WorldData.cs
  • test/NosCore.EndToEnd.Tests/Scenarios/PetTests.cs
  • test/NosCore.GameObject.Tests/Services/BattleService/MateBasicAttackTests.cs
  • test/NosCore.GameObject.Tests/Services/BattleService/SkillResolverTests.cs
  • test/NosCore.PacketHandlers.Tests/Mates/MatePacketDeserializationTests.cs
  • test/NosCore.PacketHandlers.Tests/Mates/SuCtlPacketHandlerTests.cs
  • test/NosCore.PacketHandlers.Tests/Mates/UpetPacketHandlerTests.cs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Copy link
Copy Markdown
Collaborator Author

Checked against the lab server, before and after

Bot packets. The bot owned a level 30 pet with skill 790 (vnum 709) and one with no skills (vnum 9). It sent each at a nearby monster five times with suctl and five times with a u_pet basic attack.

Pet Master This branch
709, skill 790 Both suctl and u_pet make it cast its own skill on itself: su 2 <pet> 2 <pet> 790 800 11 4403 and a self-buff (card 841). The monster is never hit, and u_pet recasts every 3.5 s despite the skill's 80 s cooldown. su 2 <pet> 3 2395 0 14 11 0: skill 0, cooldown 14, effect 0, with no skill and no card
9, no skills Every suctl is refused silently, with no su. u_pet already hits with 0 12 11 200. Both suctl and u_pet hit with su 2 <pet> 3 2395 0 12 11 200, and it killed the monster twice

The new values match the packet traces: 0 14 11 0 for vnum 709 and 0 12 11 200 for the starter pet.

Not checked in the browser client. A basic attack ordered from 4 cells away sometimes got no answer, while one from 3 cells landed. That looks like the pet's reach limit and is outside this change.


Generated by Claude Code


Generated by Claude Code

@erwan-joly
erwan-joly merged commit 2356a8d into master Nov 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A pet's basic attack swings with its first skill

2 participants